﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter1.Section5
{
    public class Example09
    {
        public Example09()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
            V.Matrix A = new V.Matrix(3, 3);

            A[0, 0] = 2.0;
            A[0, 1] = 4.0;
            A[0, 2] = 0.0;
            A[1, 0] = 0.0;
            A[1, 1] = 2.0;
            A[1, 2] = 1.0;
            A[2, 0] = 3.0;
            A[2, 1] = 0.0;
            A[2, 2] = 2.0;

            V.Matrix Ai = new V.Matrix(3, 3);

            Ai[0, 0] = 4.0;
            Ai[0, 1] = -8.0;
            Ai[0, 2] = 4.0;
            Ai[1, 0] = 3.0;
            Ai[1, 1] = 4.0;
            Ai[1, 2] = -2.0;
            Ai[2, 0] = -6.0;
            Ai[2, 1] = 12.0;
            Ai[2, 2] = 4.0;

            V.Matrix C = (A*Ai)*(1.0/20.0);

            result += C[0, 0].ToString() + "   " + C[0, 1].ToString() + "   " + C[0, 2].ToString() + "\r\n";
            result += C[1, 0].ToString() + "   " + C[1, 1].ToString() + "   " + C[1, 2].ToString() + "\r\n";
            result += C[2, 0].ToString() + "   " + C[2, 1].ToString() + "   " + C[2, 2].ToString() + "\r\n";
        }
    }
}

/*
1   0   0
0   1   0
0   0   1
*/

